<?php
$users = array(
    "admin" => "pass"
);


// Returns true if $username and $password are valid.
function credentials_valid($username, $password) {
  global $users;
    return isset($users[$username]) &&
           $users[$username] == $password;
}

// Logs into the user $user
function log_in($user) {
    $_SESSION['user'] = $user;
}


// Returns the currently logged in user (if any)
function current_user(){
    return $_SESSION['user'];
}
?>